import scrapy


class Demo(scrapy.Spider):
    # 定义爬虫名称
    name = 'Demo'
    # 爬虫域名
    # allowed_domains = ['www.dhgate.com']
    # 爬虫链接
    start_urls = ['https://www.lagou.com/']

    def parse(self, response):
        for item in response.xpath('//div[@class="menu_box"]/div/dl/dd/a'):

            jobClass = item.xpath('text()').extract()  # 提取文本内容
            jobUrl = item.xpath("@href").extract_first()  # 提取链接内容
            print("jobUrl:" + jobUrl)
        pass
